package com.natasha.pins.view.fragment;

import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v4.widget.SimpleCursorAdapter;
import android.widget.Toast;

public class PrivatePinsFragmentActivity extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> {
	
	private static final String[] PROJECTION = new String[] { "_id", "text_column" };
	private static final int LOADER_ID = 1;
	private LoaderManager.LoaderCallbacks<Cursor> mCallbacks;
	private SimpleCursorAdapter mAdapter;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);
	    getSupportLoaderManager().initLoader(0, null, this);
	    
	    String[] dataColumns = { "text_column" };
	    int[] viewIDs = { R.id.text_view };
	    mAdapter = new SimpleCursorAdapter(this, R.layout.list_item,
	        null, dataColumns, viewIDs, 0);
	    setListAdapter(mAdapter);
	    mCallbacks = this;
	    LoaderManager lm = getLoaderManager();
	    lm.initLoader(LOADER_ID, null, mCallbacks);
	}

	@Override
	public Loader<Cursor> onCreateLoader(int i, Bundle bundle){
	    return null; // TODO
	}

	@Override
	public void onLoadFinished(Loader loader, Cursor cursor) {
	    Toast.makeText(this, "onLoadFinished", Toast.LENGTH_SHORT).show();
	}

	@Override
	public void onLoaderReset(Loader loader)    {
	    Toast.makeText(this, "onLoaderReset", Toast.LENGTH_SHORT).show();
	}
	
	
}